//
//  MYGResumeTipView.swift
//  MYDoctor
//
//  Created by 小火科技 on 2024/4/12.
//

import UIKit

class MYGResumeTipView: UIView {

    var buttonBlock:(()->Void)?
    var isEdit:Bool = false {
        didSet {
            if isEdit == true {
                //saveButton.setImage(UIImage(named: "re_del"), for: .normal)
            }
            
        }
    }
    var title:String? {
        didSet {
            guard let str = title else {return}
            titleLabel.text = str
        }
        
    }
    
    // MARK: - init
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        configUI()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    // MARK: - UI
    private func configUI() {
        backgroundColor = .white
        
        addSubview(line)
        addSubview(titleLabel)
        addSubview(saveButton)
        
        line.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.left.equalTo(17.5)
            make.width.equalTo(3)
            make.height.equalTo(15)
        }
        
        titleLabel.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.left.equalTo(line.snp.right).offset(15)
        }
        
        saveButton.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.height.width.equalTo(16)
            make.right.equalToSuperview().offset(-37)
        }
        
    }

    private lazy var line : UIView = {
        let line = UIView()
        line.backgroundColor = .rgba(73, 117, 236, 1)
        return line
    }()
    
    private lazy var titleLabel : UILabel = {
        let label = UILabel()
        label.font = .medium(18)
        label.textColor = .rgba(34, 34, 34, 1)
        label.text = "工作经历"
        return label
    }()
    
    private lazy var saveButton: UIButton = {
        let btn = UIButton()
        btn.setImage(UIImage(named: "icon_tianjia"), for: .normal)
        //saveButton.setImage(UIImage(named: "re_del"), for: .normal)
        btn.addTarget(self, action: #selector(clickButton), for: .touchUpInside)
        return btn
    }()
    
    @objc func clickButton(){
        
        buttonBlock?()
    }
}
